home *** CD-ROM | disk | FTP | other *** search
- Doom is a registered trademark of id software. I claim no affiliation
- with id.
-
- Well, here is my first attempt at implementing the most basic
- concepts for a 3D type engine somewhere between Wolf3D and Doom. I know
- it's not much, but I thought I would release it to the populace anyway.
- The astute person will realize that there is only one height for every
- wall, and the floors/ceilings are at constant height. This is a limitation
- that allowed me some important optimizations when I was designing this
- program. However, with what I have learned since (this program was
- originally written for a graphics project (hence the name) as school last
- spring), I think I could write a much more versatile engine that is just
- as fast.
-
- This program does its depth sorting using the by now all too famous
- BSP tree. It uses a back-to-front traversal, as opposed to the front-
- to-back method Doom uses. The reason for this is that I am not using
- mode X (as Doom does), and I think for simple levels like the one
- this engine is using, that keeping an off-screen buffer and just blasting
- that to the VGA is just as fast (and a hell of a lot easier :-). This
- engine has the ability to render non-orthogonal walls, but constructing
- a BSP tree for a level containing such walls is not trivial, and I didn't
- want to spend the time implementing a BSP tree builder (which is also
- non-trivial) for this first attempt.
-
- The entire program is written in C and compiled with Watcom 9.5. My
- personal belief is that VERY little would be gained by converting any
- of this code to assembly as the Watcom compiler is VERY good at code
- optimization. I spent a little time researching its optimization methods
- and attempted to write the t-mapping routines to lend themselves well to
- its optimization methods (read: they are unrolled already). The code is
- fairly portable. I was able to port it to X (with MIT-SHM, BTW) in about
- 5 hours. I have compiled and ran this X port on all sorts of UNIX machines
- ranging from LINUX boxes to HP Geckos with interesting results.
-
- I actually wrote my own clipping algorithm. I don't clip in screen space
- since that can create interesting resultant geometric shapes; rather,
- I used a method that I figured out (which maybe someone else did too)
- involving parametric lines. This clipping proves to be pretty fast, but
- it has a problem. In the clipping process, there is a divide which has
- a fixed-point representation in the denominator. This SEVERELY limits
- the accuracy of the fixed-point representation since you have to use some
- amount of your precision to represent that number. Therefore, you will
- see that walls don't extend exactly to the edge of the screen sometimes.
- I have identified this problem and will fix it in my next attempt.
-
- I currently use a 486DX2-80 CPU and get ~45 fps. With my old 486-66, I
- would get ~35 fps. I think this is pretty good considering the floors
- and ceilings are texture-mapped (and the region to map on these surfaces
- was not selected very intelligently). I would be interested in hearing
- from people about which type of machine they have, and what performance
- they saw. I have ran this on machines as slow as a 386-25. While the
- frame rate was sorry, I didn't witness any tearing, flickering, or any
- of those undesirables.
-
- I did do collision detection with the walls (you can't walk through them),
- however, if you can't go the direction you want to go because a wall is in
- your way, the program just negates your move. This means if you are
- looking at a wall with a very oblique angle, and pushing the up arrow
- key, you will not move forward (as you will in Doom).
-
- There are many bugs, including: improper forshortening in the texture
- mapping, erratic clipping errors, distorted texture-mapping at close
- range, occaisional crashes, however, I think it is pretty stable at this
- point. That is why I am releasing it. At this point, I think I will
- start over and apply some of the new concepts I have learned. I also have
- an idea for texture-mapping that may prove to be a huge optimization, I'll
- let you know.
-
-
- USE:
-
- type "proj" at the command line. The keys are:
-
- up arrow : move forward
- down arrow : move backward
- left arrow : turn left
- right arrow : turn right
-
- escape : quit
-
- The forward/backward keys are buffered so you get a smooth transition from
- stopped to full speed. Try it, you'll see what I mean. The turn keys
- are not buffered in this way. It didn't seem too realistic to me.
-
- I implemented a crude replay mechanism. While you are moving around
- my level, your moves are recorded and placed in a file called "shadow.fil".
- If you start this demo with the '-r' parameter (ie: "proj -r"), it will
- replay the moves that were made the last time the program was run. There
- is no way to stop it from recording when you execute, so if you want to
- save a series of moves, rename the "shadow.fil" file before you run the
- program.
-
- From here I plan to write a more advanced engine that will read Doom wad
- files and basically display them in exactly the way that Doom does. I
- am hoping I can get my program to at least the efficiency that Doom is at.
-
- Well, anyway, here it is. Please drop me a line and let me know what you
- think.
-
-
-